# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=vorbis-tools
pkgver=1.4.0
pkgrel=8
pkgdesc='Extra tools for Ogg-Vorbis'
arch=('x86_64')
url='https://www.xiph.org/vorbis/'
license=('GPL2')
depends=('libao' 'libvorbis' 'curl' 'flac')
source=("https://downloads.xiph.org/releases/vorbis/${pkgname}-${pkgver}.tar.gz"
        '0001-vorbis-tools-cve9638-cve9639.patch'
        '0002-vorbis-tools-cve9640.patch'
        '0003-vorbis-tools-CVE-2015-6749.patch'
        '0004-fix-segfault-in-vcut.patch')
sha256sums=('a389395baa43f8e5a796c99daf62397e435a7e73531c9f44d9084055a05d22bc'
            '5a6d74de56e67613c4887e3fe9102aadfce4cd4a9a477fb2c1ed1a26f11fdff6'
            'ac4dfaba96c1f324c79dd81c88386e62508114f24d1cadcce9be48a87e58980a'
            '52f1d083c16b9caa2bc7bd5315210bac810dd6a0565e4c270650177a4c815fa7'
            '747984e0091e5ed68c190e502f1e9b6871cda216f85f3e52879986a48973938b')

prepare() {
  cd ${pkgname}-${pkgver}

  patch -p1 -i "${srcdir}/0001-vorbis-tools-cve9638-cve9639.patch"
  patch -p1 -i "${srcdir}/0002-vorbis-tools-cve9640.patch"
  patch -p1 -i "${srcdir}/0003-vorbis-tools-CVE-2015-6749.patch"
  patch -p1 -i "${srcdir}/0004-fix-segfault-in-vcut.patch"
}

build() {
  cd ${pkgname}-${pkgver}

  ./configure \
    --prefix=/usr \
    --without-speex \
    --enable-vcut
  make
}

package() {
  cd ${pkgname}-${pkgver}

  make DESTDIR="${pkgdir}" install
}
